<?php
if (!defined('BASEPATH')) exit('No direct script access allowed');

	echo	"<h2>".$title."</h2>";
	//Common::pr($getUser);
	echo	"<div class=\"accordion\">";
	echo		form_open(current_url(), array("id" => "frmSettings"));
	echo		"<article class=\"box ".((($this->session->flashdata("success_password") or (isset($response["error_password"]) and $response["error_password"])))?("open\" style=\"display:block;\""):("\"")).">";
	echo			"<header>";
	echo				"<h3>".$this->lang->line("CHANGE_PASSWORD")."</h3>";
	echo			"</header>";

	echo			"<section class=\"wide\" ".((($this->session->flashdata("success_password") or (isset($response["error_password"]) and $response["error_password"])))?("style=\"display:block;\""):("")).">";
	if($this->session->flashdata("success_password")) {
		echo				"<div class=\"alert_success\">".$this->session->flashdata("success_password")."</div>";
	} elseif(isset($response["error_password"]) and $response["error_password"]) {
		echo				"<div class=\"alert_error\">".$response["error_password"]."</div>";
	}

	$tabindex = 1;
	echo					form_password(array("name" => "usrPasswordOld", "id" => "usrPasswordOld", "tabindex" => $tabindex, "class" => "form_data data", "style" => "width: 370px; padding-right: 200px;", "value" => "")).form_input(array("class" => "inlinebutton", "style" => "margin-left: -200px;", "type" => "button", "value" => $this->lang->line("OLD_PASSWORD")))."<br/><br/>";
	$tabindex++;

	echo					form_password(array("name" => "usrPassword", "id" => "usrPassword", "tabindex" => $tabindex, "class" => "form_data data", "style" => "width: 370px; padding-right: 200px;", "value" => "")).form_input(array("class" => "inlinebutton", "style" => "margin-left: -200px;", "type" => "button", "value" => $this->lang->line("PASSWORD")))."<br/><br/>";
	$tabindex++;

	echo					form_password(array("name" => "usrPasswordRe", "id" => "usrPasswordRe", "tabindex" => $tabindex, "class" => "form_data data", "style" => "width: 370px; padding-right: 200px;", "value" => "")).form_input(array("class" => "inlinebutton", "style" => "margin-left: -200px;", "type" => "button", "value" => $this->lang->line("RE-TYPE_PASSWORD")))."<br/><br/>";
	$tabindex++;

	echo					"<p class=\"fr\">".form_input(array("class" => "button", "tabindex" => $tabindex, "style" => "margin-top:-2px;", "type" => "submit", "name" => "submit_password", "value" => $this->lang->line("CHANGE_PASSWORD")))."</p><br class=\"cb\" />";
	echo			"</section>";

	echo		"</article>";
	echo	form_close();

	
	echo		"<article class=\"box ".((($this->session->flashdata("success_email") or (isset($response["error_email"]) and $response["error_email"]) or (isset($response["error_code"]) and $response["error_code"])))?("open\" style=\"display:block;\""):("\"")).">";
	echo			"<header>";
	echo				"<h3>".$this->lang->line("CHANGE_EMAIL_ADDRESS")."</h3>";
	echo			"</header>";

	echo			"<section class=\"wide\" ".((($this->session->flashdata("success_email") or (isset($response["error_email"]) and $response["error_email"]) or (isset($response["error_code"]) and $response["error_code"])))?("style=\"display:block;\""):("")).">";
	if($this->session->flashdata("success_email")) {
		echo				"<div class=\"alert_success\">".$this->session->flashdata("success_email")."</div>";
	} elseif(isset($response["error_email"]) and $response["error_email"]) {
		echo				"<div class=\"alert_error\">".$response["error_email"]."</div>";
	}

	$tabindex = 1;
	echo				form_open(current_url(), array("id" => "frmSettingsEmail"));
	echo					"<div class=\"box grey\">".$this->lang->line("CHANGE_EMAIL_ADDRESS_HELP")."</div>";
	echo					form_input(array("name" => "usrEmailNew", "id" => "usrEmailNew", "tabindex" => $tabindex, "class" => "form_data data", "style" => "width: 370px; padding-right: 200px;", "value" => $this->input->post("usrEmailNew"))).form_input(array("class" => "inlinebutton", "style" => "margin-left: -200px;", "type" => "button", "value" => $this->lang->line("NEW_EMAIL_ADDRESS")))."<br/><br/>";
	$tabindex++;

	echo					"<p class=\"fr\">".form_input(array("class" => "button", "tabindex" => $tabindex, "style" => "margin-top:-2px;", "type" => "submit", "name" => "submit_email", "value" => $this->lang->line("CHANGE_EMAIL_ADDRESS")))."</p><br class=\"cb\" /><br class=\"cb\" />";
	echo				form_close();
	$tabindex++;
	
	if($getUser["usrEmailNew"]) {
	
		if(isset($response["error_code"]) and $response["error_code"]) {
			echo				"<div class=\"alert_error\">".$response["error_code"]."</div>";
		}
	
		echo				form_open(current_url(), array("id" => "frmSettingsEmailCode"));
		echo					"<div class=\"box grey\">".$this->lang->line("FINALIZE_EMAIL_ADDRESS_CHANGE_HELP")."</div>";

		echo					form_input(array("name" => "usrCode", "id" => "usrCode", "tabindex" => $tabindex, "class" => "form_data data", "style" => "width: 370px; padding-right: 200px;", "value" => $this->input->post("usrCode"))).form_input(array("class" => "inlinebutton", "style" => "margin-left: -200px;", "type" => "button", "value" => $this->lang->line("FIRST_VERIFICATION_CODE")))."<br/><br/>";
		$tabindex++;

		echo					form_input(array("name" => "usrCodeNew", "id" => "usrCodeNew", "tabindex" => $tabindex, "class" => "form_data data", "style" => "width: 370px; padding-right: 200px;", "value" => $this->input->post("usrCodeNew"))).form_input(array("class" => "inlinebutton", "style" => "margin-left: -200px;", "type" => "button", "value" => $this->lang->line("SECOND_VERIFICATION_CODE")))."<br/><br/>";
		$tabindex++;
		
		echo					"<p class=\"fr\">".form_input(array("class" => "button", "tabindex" => $tabindex, "style" => "margin-top:-2px;", "type" => "submit", "name" => "submit_code", "value" => $this->lang->line("FINALIZE_EMAIL_ADDRESS_CHANGE")))."</p><br class=\"cb\" />";
		echo				form_close();
	}

	
	echo			"</section>";

	echo		"</article>";
	echo	"</div>";